﻿using AutoMapper;
using MNH.Yarekoodak.DomainClasses;
using MNH.Yarekoodak.WebApps.Models;


namespace MNH.Yarekoodak.WebApps
{
    public static class MappingExtensions
    {
        #region User

        public static RegisterViewModel ToModel(this User entity)
        {
            Mapper.CreateMap<User, RegisterViewModel>();
            return Mapper.Map<User, RegisterViewModel>(entity);
        }

        public static User ToEntity(this RegisterViewModel model)
        {
            Mapper.CreateMap<RegisterViewModel, User>();
            return Mapper.Map<RegisterViewModel, User>(model);
        }

        public static User ToEntity(this RegisterViewModel model, User destination)
        {
            Mapper.CreateMap<RegisterViewModel, User>();
            return Mapper.Map(model, destination);
        }

        #endregion

        
    }
}